package org.braemarframework.business {
	import flash.events.Event;
	import flash.net.URLRequestMethod;

	import com.sshc625.events.ServiceEvent;

	/**
	 * @author sshc625
	 */
	public class XMLService extends HTTPService {
		/**
		 * XMLService
		 * @param       Location of the IService
		 * @param       [optional]      Method used to send data to IService
		 */
		public function XMLService( url:String, method:String = URLRequestMethod.POST ):void {
			super( url, method );
		}

		/**
		 * Executes when the IService responds succesfully
		 * @param       Event which triggers the method
		 */
		override protected function onResult( event:Event ):void {
			// Dispatch event
			var evt:ServiceEvent = new ServiceEvent( ServiceEvent.RESULT );
			evt.result = new XML( this._loader.data );
			this.dispatchEvent( evt );

			this.dispose();
		}
	}
}
